package com.yxhl.zoume.domain.interactor.car.specialcar;

import com.yxhl.zoume.data.http.repository.car.SpecialCarRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.specialcar.CancelOrderParam;
import com.yxhl.zoume.data.http.rest.response.specialcar.CancelOrderResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by sugarya on 16/4/23.
 */
public class CancelSpecialCarOrderUseCase extends UseCase<CancelOrderResponse> {

    private SpecialCarRepository mSpecialCarRepository;

    @Inject
    public CancelSpecialCarOrderUseCase(
            @Named(DomainConstants.UI_THREAD) Scheduler uiThread,
            @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread,
            SpecialCarRepository specialCarRepository
    ) {
        super(uiThread, executorThread);
        mSpecialCarRepository = specialCarRepository;
    }

    @Override
    protected Observable<CancelOrderResponse> buildObservable(RequestParamImpl param) {
        return mSpecialCarRepository.cancelSpecialCarOrder((CancelOrderParam) param)
                .subscribeOn(executorThread)
                .observeOn(uiThread);
    }
}
